package org.rebluh.hulunbuirtravelnetworkbackendframework.controller;

import org.rebluh.hulunbuirtravelnetworkbackendframework.service.EmailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/email")
public class EmailController {
    @Autowired
    private EmailService emailService;

    @PostMapping("/sendEmailCode")
    public String sendEmailCode(@RequestParam("email") String email) {
        if (emailService.sendEmailCode(email)){
            return "success";
        }else return "fail";
    }
}
